#map_print2.py
#map_print.py
from numpy import ndarray
def htmlprinter(map, ctime):	
	htmlmap = ctime +'.html'
	hm = open(htmlmap, "a")
	hm.write("<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"map_table.css\" />\n</head>\n<body><table>\n")
	hm_cur_line = "<tr>"
	height = int(map.shape[0])
	width = int(map.shape[1])
	for i in range(height):
		for j in range(width):
			c = map[i,j][0]
			if c == 0:
				hm_cur_line = hm_cur_line + "<td class=\"r\"> </td>"#ravine
			elif c == 1:
				hm_cur_line = hm_cur_line + "<td class=\"f\"> </td>" #flat
			elif c == 2:
				hm_cur_line = hm_cur_line + "<td class=\"h\"> </td>"#hill
			elif c == 3:
				hm_cur_line = hm_cur_line + "<td class=\"m\"> </td>"#mountain
			elif c == 4:
				hm_cur_line = hm_cur_line + "<td class=\"c\"> </td>"#cliff
			elif c == 5:
				hm_cur_line = hm_cur_line + "<td class=\"cent\"> </td>"#cent
		hm_cur_line = hm_cur_line + "</tr>\n"
		hm.write(hm_cur_line)
		hm_cur_line = "<tr>"
	hm.write("</table>\n</body>\n</html>")
	hm.close()
	return
